1. Field of the Invention
The present invention relates to an image processing method.and apparatus for reducing the number of gradation levels of image data through performing error diffusion processing with multiple levels.
2. Description of the Related Art
When an image with a multiple-level gradation obtained through a computer or an image input apparatus, for example, is outputted through an image output apparatus such as a printer with a fewer gradation level, the number of gradation levels of the image data is required to be reduced. Pseudo halftone representation has been conventionally utilized for maintaining the image quality of an original image as high as possible while reducing the number of gradation levels. Among several methods of the pseudo halftone representation, an error diffusion method capable of producing a high-quality image has been widely used for printers with two levels of output gradation, for example. Also, a multiple-level error diffusion method with three or more quantization levels has been proposed for an image output apparatus capable of representing three or more gradation levels. It is to be noted that the error diffusion method is a method of diffusing a quantization error resulting from a target pixel into input image data of unquantized pixels near the target pixel.
The general principle of the error diffusion method will now be described in detail with reference to Hitoshi Takaie and Mitsuo Yae, xe2x80x98Gradation Conversion Technique of Digital Image Data with Cxe2x80x99, in Interface, August 1993, pp. 158-171.
The error diffusion method is to represent pseudo halftones through modulating quantization errors into a high frequency band to be less perceptible considering a characteristic of human visual perception. FIG. 1 is a block diagram of an image processing apparatus for implementing typical error diffusion processing. The image processing apparatus comprises: a subtracter 211 for subtracting output data of a filter 214 described below from input image data x (i, j); a quantizer (shown as Q) 212 for quantizing output data of the subtracter 211 and outputting the result as output image data y (i, j); a subtracter 213 for subtracting output data of the subtracter 211 from output image data y (i, j); and the filter 214 for performing specific filtering process on the output data of the subtracter 213 and outputting the result to the subtracter 211. In the drawing, e (i, j) represents a quantization error produced through quantization at the quantizer 212. Therefore, the output data of the subtracter 213 is quantization error e (i, j). Coordinates of two directions intersecting at right angles each other are represented by xe2x80x98ixe2x80x99 and xe2x80x98jxe2x80x99, respectively. The two directions will be called i direction and j direction, respectively.
The filter 214 is a sort of linear filter. The transfer function thereof is determined to be G (z1, z2). Signs z1, and z2 are variables in z transformation in i direction and j direction, respectively. The overall configuration of the image processing apparatus shown in FIG. 1 is regarded as a two-dimensional sigma-delta modulation circuit. Therefore, expression (1) below is given for the relationship of input and output in the image processing apparatus.
Y(z1,z2)=X(z1,z2)+H(z1,z2)E(z1,z2)xe2x80x83xe2x80x83(1)
In the expression (1), Y(z1, z2), X(z1, z2) and E(z1, z2) are values produced through z transformation of y (i, j), x (i, j) and e (i, j), respectively. Transfer function H(z1, z2) of the filter for modulating quantization error E(z1, z2) is given by an expression (2) below.
H(z1, z2)=1xe2x88x92G(z1,z2)xe2x80x83xe2x80x83(2)
The transfer function H(z1, z2) represents a high-pass filter of two-dimensional finite impulse response (FIR). The high-pass filter is a filter for modulating quantization errors which determine a modulation characteristic of quatization error E(z1, z2) to a higher frequency band. In the following description, filters indicated with transfer functions H(z1, z2) and G (z1, z2) are shown as filter H(z1, z2) and filter G (z1, z2), respectively.
G(z1, z2) is given by an expression (3) below.
G(z1, (z2)=xcexa3xcexa3g(n1,n2)z1xe2x88x92n1z2xe2x88x92n2xe2x80x83xe2x80x83(3)
The first xcexa3 in the expression (3) indicates a sum when n1 is from xe2x88x92N1 to M1. The second xcexa3 in the expression (3) indicates a sum when n2 is from xe2x88x92N2 to M2. Each of N1, M1, N2 and M2 is a predetermined positive integer.
A filter coefficient is given by g (n1,n2) and a target pixel by n1=0 and n2=0.
However, the quality of an image deteriorates in the multiple-level error diffusion method with fewer quantization levels. For example, when tones of an original image are close to the quantization levels, texture variations are conspicuous and pseudo contours are produced. This is caused by an absence of a random pattern specific to the error diffusion method, which is partly found in an output image. When a tone of original image data is close to a quantization level, an output level is a single quantization level and thereby it results in the absence of the random pattern results.
In order to prevent effectively image quality deterioration due to texture variations, a method is known for superimposing a regular pattern or random noise on image data. However, the method increases errors in every gradation level in original image data. This sacrifices the best feature of the error diffusion method for producing minimized errors. Consequently, the texture of the regular pattern does not match the texture of the error diffusion method. Another problem is, for example, enhanced roughness in an output image.
Also, a method has been proposed for step-by-step error diffusion processing with levels of two to three, then to five as disclosed in Hiroshi Ochi, xe2x80x98High Quality Multiple-level Error Diffusion Method using Gradation Level Processingxe2x80x99, Processing of Image Electronics Institute, 24, 1, pp. 10-17, 1995-01. However, it takes longer time in performing computation required by the step-by-step processing. Another problem is that roughness is greater since four output levels or above may be used for representing a particular gradation level. A compensation process thereof is required, too.
In view of the above problems, it is an object of the present invention to provide an image processing method and apparatus capable of producing a high-quality image with a uniform texture and reduced roughness through a multiple-level error diffusion processing while reducing the number of gradations of image data.
An image processing method of the present invention comprises a first error diffusion processing step and a second error diffusion processing step. The first error diffusion processing step quantizes input image data for each pixel to convert the quantized input image data into image data having a predetermined quantization level for outputting and diffuses a quantization error of a target pixel produced through quantization to input image data of an unquantized pixel near the target pixel when the gradation value of the input image data is within a predetermined quantization-executable range, and outputs the input image data without quantizing the input image data when the gradation value is not within the predetermined quantization-executalbe range. The second error diffusion processing step quantizes the image data outputted by the first error diffusion processing step for each pixel to convert the quantized image data into output image data having one of three or more quantization levels including a quantization level different from the quantization level in the first error diffusion processing step for outputting and diffuses a quantization error of the target pixel produced through quantization to image data of an unquantized pixel near the target pixel.
An image processing apparatus of the present invention comprises first error diffusion processing means and second error diffusion processing means. The first error diffusion processing means comprises selective quantization means for quantizing input image data for each pixel to convert the quantized input image data into image data having a predetermined quantization level for outputting and diffusing a quantization error of a target pixel produced through quantization to input image data of unquantized pixel near the target pixel, when the gradation value of the input image data is within a predetermined quantization-executable range, and for outputting the input image data without quantizing the input image data, when the gradation value is not within the predetermined quantization-executable range; and first error diffusion means for diffusing a quantization error of a target pixel produced through quantization into input image data of an unquantized pixel near the target pixel, when the gradation value of the input image data is within a predetermined quantization-executable range, and for outputting the input image data without quantizing the input image data, when the gradation value is not within the predetermined quantization-executable range. The second error diffusion processing means comprises quantization means for quantizing the image data outputted by the first error diffusion processing means for each pixel to convert the quantized image data into output data having one of three or more quantization levels including a quantization level different from the quantization level at the first error diffusion processing means for outputting; and second error diffusion means for diffusing a quantization error of the target pixel produced through quantization to image data of an unquantized pixel near the target pixel.
According to the image processing method of the invention, in the first error diffusion processing step, when the gradation value of the input image data is within the predetermined quantization-executable range, the input image data is quantized for each pixel to be converted to image data having the predetermined quantization level for outputting and the quantization error of the target pixel produced through quantization is diffused into input image data of an unquantized pixel near the target pixel. Also, in the first error diffusion processing step, when the gradation value of the input image data is not within the predetermined quantization-executable range, the input image data is outputted without quantization thereof In the second error diffusion processing step, the image data outputted by the first error diffusion processing step is quantized for each pixel to be converted to output image data having one of three or more quantization levels including a quantization level different from the quantization level in the first error diffusion processing step for outputting and the quantization error of the target pixel produced through quantization is diffused into image data of an unquantized pixel near the target pixel.
According to the image processing apparatus of the invention, in the first error diffusion processing means, input image data is quantized for each pixel to be converted into image data having a predetermined quantization level for outputting and a quantization error of a target pixel produced through quantization is diffused to input image data of unquantized pixel near the target pixel when the gradation value of the input image data is within a predetermined quantization-executable range, and the input image data is outputted without quantizing the input image data when the gradation value is not within the predetermined quantization-executable range by the selective quantization means, and a quantization error of a target pixel produced through the quantization at the selective quantization means is diffused into input image data of unquantized pixel near the target pixel by the error diffusing means. In the second error diffusion processing means, the image data outputted by the first error diffusion processing means is quantized for each pixel to be converted into output data having one of three or more quantization levels including a quantization level different from the quantization level at the first error diffusion processing means for outputting by the quantization means, and a quantization error of the target pixel produced through the quantization at the quantization means is diffused into image data of an unquantized pixel near the target pixel by the second error diffusion means.
Other and further objects, features and advantages of the invention will appear more fully from the following description.